/* 
类类型: 实现接口
1. 一个类可以实现多个接口
2. 一个接口可以继承多个接口

*/
(function () {
  interface Alarm {
    alert (): void
  }

  interface Light {
    lightOn (): void

    lightOff (): void
  }

  class Car implements Alarm, Light {
    alert (): void {
      console.log('Car alert()')
    }

    lightOn (): void {
      console.log('Car lightOn()')
    }

    lightOff (): void {
      console.log('Car lightOff()')
    }
  }

  const c: Car = new Car()
  c.alert()
  c.lightOff()
  c.lightOn()
  // c.lightOff2()  // error

  interface AA extends Alarm, Light {

  }

  class Car2 implements AA {
    alert (): void {
      console.log('Car2 alert()')
    }

    lightOn (): void {
      console.log('Car2 lightOn()')
    }

    lightOff (): void {
      console.log('Car2 lightOff()')
    }
  }
})()